package com.maimao.kill.client;

import com.maimao.core.constant.ServiceContainer;
import com.maimao.core.interceptor.FeignInterceptor;
import com.maimao.core.model.resp.Result;
import com.maimao.kill.client.fallback.AddressCallBackFactory;
import com.maimao.model.info.Address;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author MaoLin Wang
 * @date 2020/12/22 7:54 下午
 */
@RequestMapping("/info/address")
@FeignClient(contextId = "addressClient", value = ServiceContainer.INFO_SERVICE, fallbackFactory = AddressCallBackFactory.class, configuration = FeignInterceptor.class)
public interface AddressClient {

    /**
     * 获取用户默认地址 没有则为空
     * @param userId 用户id
     * @return 默认地址 or null
     */
    @GetMapping("/client/default")
    Result<Address> defaultAddress(@RequestParam("userId") Long userId);

}
